﻿
@model Zor_Web.Models.Stat.V_AnnualTaxChart
@using Webdiyer.WebControls.Mvc;
@using Zor_Tools;
@{
    Layout = null;
}
<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>年度税收统计图表</title>
    <link href="~/Content/LayerUI/src/css/layui.css" rel="stylesheet" />
    <link href="~/Content/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="~/Content/Styles/zor.css" rel="stylesheet" />
    <!-- 框架必要 -->
    <script src="~/Content/Scripts/jquery/jquery-1.9.1.min.js"></script>
    <script src="~/Content/Scripts/learunui-framework.js"></script>
    <script src="~/Content/Scripts/Zor_AJax.js"></script>
    <!-- 消息提示 -->
    <script language='javascript' src='~/Content/layer/layer.js'></script>
    <!-- 饼图 -->
    <script src="~/Content/Scripts/Echart/echarts.min.js"></script>
</head>
<body>
    <div id="TaxChart"></div>  
</body>
</html>
<script type="text/javascript">
    //获取街道办对应的税收统计数据
    var pie_Tax;
    getAjax("/Stat/AnnualTax_Pie", "", function (data) {
        pie_Tax = eval(data);
    })
    // 基于准备好的dom，初始化echarts实例
    //var myChart = echarts.init(document.getElementById('TaxChart'));

    var myChart = document.getElementById('TaxChart');
    var myChartContainer = function () {
        myChart.style.width = (window.innerWidth - 50) + 'px';
        myChart.style.height = (window.innerHeight) + 'px';
    };
    myChartContainer();
    var eChart = echarts.init(myChart);
    
    // 指定图表的配置项和数据
    option = {
        title : {
            text: '年度税收统计图表',
            subtext: '',
            x:'center'
        },
        tooltip : {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        legend: {
            orient: 'vertical',
            left: 'left',           
        },
        toolbox: {
            show : true,
            feature : {
                dataView : {show: true, readOnly: true},
                restore : {show: true},
                saveAsImage : {show: true}
            }
        },
        series : [
            {
                name: '',
                type: 'pie',
                radius : '55%',
                center: ['50%', '60%'],
                data: pie_Tax
            }
        ]
    };

    // 使用刚指定的配置项和数据显示图表。
    //myChart.setOption(option);
    eChart.setOption(option);
    //浏览器大小改变时重置大小
    window.onresize = function () {
        myChartContainer();
        eChart.resize();
    };
</script>